module WebappHelper
  
  
  
  def when_happened(record)
    "#{t(:when_happened_prefix)} #{time_ago_in_words(record.created_at)}"
  end
  def page_title
    "some page title"
  end
  def keywords
    "teste keywords"
  end
  
  def template_css
    WEBAPP_CONFIG['template_css']
  end
  def template_name
    WEBAPP_CONFIG['template']
  end
  def statics_url
    #Assumes the same host and same protocol by default
    #Check webapp_config.yml for the variable statics_url  
    WEBAPP_CONFIG['statics_url'] || request.protocol+request.host_with_port
    
  end
  
  
  def images_url
    #check webapp_config.yml for images_dir
    statics_url+WEBAPP_CONFIG['images_dir']     
  end
  
  
  #escape except <br>
  def h_br(s)
    html_escape(s).gsub(/&lt;br&gt;/i,"<br>")
  end
  
  def analitycs_code
    if (SiteConfiguration.get_string_prop("analitycs_tracking_code") && !SiteConfiguration.get_string_prop("analitycs_tracking_code").empty?)
      fb_google_analytics(SiteConfiguration.get_string_prop("analitycs_tracking_code"))
    end
  end
  
end
